//
//  CC_ImageLabel_CollectionViewCell.m
//  HimalayaMountain
//
//  Created by dllo on 16/7/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CC_ImageLabel_CollectionViewCell.h"
#import "CCBaseSubHeadLabel.h"
#import "CC_AnchorDetailed_Model.h"


@interface CC_ImageLabel_CollectionViewCell ()

@property(nonatomic, retain)UIImageView *imageView;
@property(nonatomic, retain) CCBaseSubHeadLabel *subHeadLabel;

@end


@implementation CC_ImageLabel_CollectionViewCell

-(void)dealloc{
    
    [_anchorDetailedModel release];
    [_imageView release];
    [_subHeadLabel release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        self.imageView = [[UIImageView alloc]init];
//                self.imageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_imageView];
        [_imageView release];
        
        
        self.subHeadLabel = [[CCBaseSubHeadLabel alloc]init];
//                self.subHeadLabel.backgroundColor = [UIColor greenColor];
        self.subHeadLabel.numberOfLines = 2;
        [self.contentView addSubview:_subHeadLabel];
        [_subHeadLabel release];
        
    }
    return self;
}

-(void)layoutSubviews{
    
    [super layoutSubviews];
    

    self.imageView.frame = CGRectMake(0, 0, (SCREENWIDTH - 6 * SPACED) / 3 , (SCREENWIDTH - 6 * SPACED) / 3 * 1.2);
    
    
    [self.subHeadLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.imageView.mas_bottom).offset(SPACED);
        make.left.equalTo(self.contentView.mas_left).offset(0);
        make.bottom.equalTo(self.contentView.mas_bottom).offset(0);
        make.right.equalTo(self.contentView.mas_right).offset(0);
        
        
    }];
    
    
}

-(void)setAnchorDetailedModel:(CC_AnchorDetailed_Model *)anchorDetailedModel{
    
    if (_anchorDetailedModel != anchorDetailedModel) {
        [_anchorDetailedModel release];
        _anchorDetailedModel = [anchorDetailedModel retain];
    }
    
    [self.imageView setImageWithURL:[NSURL URLWithString:anchorDetailedModel.middleLogo]];
    self.subHeadLabel.text = anchorDetailedModel.verifyTitle;
    
}




@end
